package org.spiderdesign.core.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.spiderdesign.core.model.Employee;
import org.spiderdesign.core.model.SpiderFlow;
import org.spiderdesign.core.model.vo.EmployeeVO;

public interface EmployeeMapper extends BaseMapper<Employee> {
    @Select({
            "<script>",
            "select ",
            "actual_name , ",
            "gender, ",
            "login_name , ",
            "phone, ",
            "email, ",
            "department_id,",
            "disabled_flag, ",
            "position_id, ",
            "create_time as createTime ",
            "from sp_employee ",  // 实际表名
            "<where>",
            // 固定条件：只查询未删除的数据（deleted_flag=0）
            "deleted_flag = 0 ",
            // 动态条件：姓名模糊搜索（若name不为空）
//            "<if test=\"name != null and name.trim() != ''\">",
//            "AND name like concat('%', #{name}, '%') ",
//            "</if>",
            "</where>",
            "order by create_time desc ",
            "</script>"
    })
    IPage<Employee> selectEmployeePage(@Param("page") Page<Employee> page);
}
